package org.llc.flink.study.example

/**
  * @Date 2021/4/2 16:59
  * @Version 10.21
  * @Author xx
  */
object List06 {
  def main(args: Array[String]): Unit = {
    val res1 = (1 to 5).scanLeft(5)(minus)
    // res1 = Vector(5, 4, 2, -1, -5, -10)
    println("res1 = " + res1)


    val res2 = (1 to 5).scanRight(5)(add)
    // res2 = Vector(20, 19, 17, 14, 10, 5)
    println("res2 = " + res2)


  }


  def minus(n1: Int, n2: Int): Int = {
    n1 - n2
  }

  def add(n1: Int, n2: Int): Int = {
    n1 + n2
  }
}
